package com.hanhy.Page;

import com.hanhy.util.ConfigUtil;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Reporter;

public class IndexPage extends BasePage {


    public IndexPage(WebDriver driver) throws Exception {
        super(driver);
    }

    By greetingLinkLocator = By.xpath("//div[@class='m_b_con']/div[@class='welcom ']");


    public String currentUrl() {
        return this.driver.getCurrentUrl();
    }

    public String getGreetingText() {
        return this.driver.findElement(greetingLinkLocator).getText();
    }

    public BidIndexPage getIntoBidIndexByUrl() throws Exception{
        String url = "http://" + ConfigUtil.getConstantValue("tenant_host") +"."+ ConfigUtil.getConstantValue("part_host") + "/"+ConfigUtil.getConstantValue("bid_indexUrl_part");
        Reporter.log(url);
        this.driver.get(url);
        return new BidIndexPage(this.driver);
    }


}
